/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.rainbow.log;

import java.util.Map;


/**
 *
 * @author hironaga
 */
public class LogFactory {

    public enum LoggerLib{

        LOG4J("log4j"),
        LOGGING("java.util.logging");

        private LoggerLib(String name){
            this.name = name;
        }
        private String name;
        public String value(){
            return name;
        }

    }

//    private static Map<String, Log> log4jCashe;
//    private static Map<String, Log> loggingCashe;

    public static Log getLogger(String loggerName, String loggerLib) {
        
        Log log = null;

        if(LoggerLib.LOG4J.value().equals(loggerLib)){
//            if(log4jCashe.get(clazz.getName()) != null){
//                log = log4jCashe.get(clazz.getName());
//            }
//            else{
//                Log log4j = new Log4jLogger(org.apache.log4j.Logger.getLogger(clazz));
//                log4jCashe.put(clazz.getName(), log4j);
//                log = log4j;
//            }
            Log log4j = new Log4jLogger(org.apache.log4j.Logger.getLogger(loggerName));
            return log4j;
        }
        else if(LoggerLib.LOGGING.value().equals(loggerLib)){
            throw new UnsupportedOperationException("java.util.loggin has not been implemented");
        }
        
        return log;
    }

//    public static Log getLogger(Class clazz, String loggerlib) {
//
//        Log log = null;
//
//        if(LoggerLib.LOG4J.value().equals(loggerlib)){
//            if(log4jCashe.get(clazz.getName()) != null){
//                log = log4jCashe.get(clazz.getName());
//            }
//            else{
//                Log log4j = new Log4jLogger(org.apache.log4j.Logger.getLogger(clazz));
//                log4jCashe.put(clazz.getName(), log4j);
//                log = log4j;
//            }
//        }
//        else if(LoggerLib.LOGGING.value().equals(loggerlib)){
//            //未実装
//        }
//
//        return log;
//    }

}
